<template lang="pug">
    scroll-view(scroll-x class="bg-white nav")
        view(class="flex text-center")
            view(class="cu-item flex-sub" v-for="item in items" 
                    :key="item.key" @tap="nav_btn_tap(item.key)"
                    :class="cur_key== item.key ? 'text-orange cur': ''")  {{item.name}}
</template>
<script>
export default {
  name: "task-navigaiton",

  data() {
    return {
      cur_key: "my_tasks",

      items: [
        { name: "我的待办", key: "my_tasks" },
        { name: "共享待办", key: "share_tasks" }
      ]
    };
  },

  methods: {
    nav_btn_tap(key) {
      if (this.cur_key === key) return;
      this.cur_key = key;
      this.$emit("navigation-change", key);
    }
  }
};
</script>